r = 1 corpse = 1 gotstatue = 0 gotmap = 1 COLOR 2, 0 CLS DIM SHARED DOOM AS DOUBLE Minutes = 10 Seconds = 0 GameTime = Minutes * 60 + Seconds DIM directions(1 TO 20) AS STRING directions(1) = "NORTH, SOUTH, EAST, OR WEST" directions(2) = "EAST, WEST, OR SOUTH" directions(3) = "WEST OR SOUTH" directions(4) = "NORTH, SOUTH, OR WEST" directions(5) = "NORTH OR WEST" directions(6) = "NORTH, EAST, OR WEST" directions(7) = "NORTH OR EAST" directions(8) = "NORTH, SOUTH, EAST, OR WEST" directions(9) = "EAST OR SOUTH" directions(10) = "EAST, WEST, OR SOUTH" directions(11) = "NORTH, EAST, OR WEST" directions(12) = "SOUTH" directions(13) = "NORTH OR EAST" directions(14) = "WEST OR SOUTH" directions(15) = "EAST" directions(16) = "NORTH OR SOUTH" directions(17) = "NORTH OR SOUTH" directions(18) = "NORTH OR EAST" directions(19) = "EAST OR WEST" directions(20) = "WEST" PRINT "" PRINT "" PRINT "It's been a long venture and yet you've finally made it. The lost" PRINT "tomb of the cursed King Lubok. Some say a curse is placed upon this" PRINT "hidden world, though a treasure rests within it's walls. Are you" PRINT "brave enough to continue?" PRINT "" PRINT "" ' This works here because the Inkey buffer is empty. DO: LOOP UNTIL INKEY$ <> "" DOOM = TIMER(0.001) + GameTime 'change this to to desied time for the game to run DO CLS PRINT "" PRINT "" PRINT " The Lost Crypt" PRINT " Written by" PRINT " D.B. Taylor" PRINT " Copyright (c) 2016" PRINT "" PRINT SPACE$(38); IF INSTR(directions(r), "NORTH") THEN PRINT "N" ELSE PRINT PRINT "*---------------------------------* "; IF INSTR(directions(r), "WEST") THEN PRINT "W"; ELSE PRINT " "; PRINT " + "; IF INSTR(directions(r), "EAST") THEN PRINT "E"; ELSE PRINT " "; PRINT " *------------------------------------*" PRINT SPACE$(38); IF INSTR(directions(r), "SOUTH") THEN PRINT "S" ELSE PRINT PRINT PRINT "If you are stuck just type HELP." PRINT PRINT "Moves:"; Movecount PRINT "" GOSUB ROOM GOSUB parser LOOP ROOM: IF r = 1 THEN: GOSUB r1 IF r = 2 THEN: GOSUB r2 IF r = 3 THEN: GOSUB r3 IF r = 4 THEN: GOSUB r4 IF r = 5 THEN: GOSUB r5 IF r = 6 THEN: GOSUB r6 IF r = 7 THEN: GOSUB r7 IF r = 8 THEN: GOSUB r8 IF r = 9 THEN: GOSUB r9 IF r = 10 THEN: GOSUB r10 IF r = 11 THEN: GOSUB r11 IF r = 12 THEN: GOSUB r12 IF r = 13 THEN: GOSUB r13 IF r = 14 THEN: GOSUB r14 IF r = 15 THEN: GOSUB r15 IF r = 16 THEN: GOSUB r16 IF r = 17 THEN: GOSUB r17 IF r = 18 THEN: GOSUB r18 IF r = 19 THEN: GOSUB r19 IF r = 20 THEN: GOSUB r20 RETURN parser: PRINT "> "; cmd$ = GrabInput cmd$ = LTRIM$(RTRIM$(UCASE$(cmd$))) IF cmd$ = "END" OR cmd$ = "QUIT" OR cmd$ = "EXIT" OR cmd$ = "Q" THEN END END IF IF cmd$ = "HELP" OR cmd$ = "H" OR cmd$ = "?" THEN CLS PRINT "HERE ARE SOME BASIC COMMANDS THAT CAN BE USED IN THE GAME..." PRINT PRINT "LOOK - CHECK FOR AVAILABLE EXITS" PRINT "NORTH, EAST ,SOUTH, AND WEST - MOVE TO AN AVAILABLE LOCATION" PRINT "EXAMINE (OBJECT) - EXAMINE AN OBJECT" PRINT "USE (OBJECT) - USE AN OBJECT" PRINT "INVENTORY - VIEW YOUR INVENTORY" PRINT "HELP - VIEW THIS SCREEN" PRINT "END - END GAME" PRINT PRINT "PRESS ANY KEY...": SLEEP DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF cmd$ = "LOOK AROUND" OR cmd$ = "LOOK" OR cmd$ = "L" THEN CLS PRINT directions(r) PRINT PRINT "PRESS ANY KEY..." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF cmd$ = "INVENTORY" OR cmd$ = "INV" OR cmd$ = "ITEMS" OR cmd$ = "I" THEN CLS PRINT "INVENTORY..." PRINT IF gotstatue = 1 THEN: PRINT "A heavy gold statue. Made in the image of a God." IF gotmap = 1 THEN: PRINT "An old weathered map given to you by your Father." PRINT PRINT "PRESS ANY KEY..." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF cmd$ = "GO NORTH" OR cmd$ = "NORTH" OR cmd$ = "N" THEN IF r = 5 THEN: r = 4: GOTO moved IF r = 4 THEN: r = 3: GOTO moved IF r = 6 THEN: r = 1: GOTO moved IF r = 1 THEN: r = 2: GOTO moved IF r = 7 THEN: r = 8: GOTO moved IF r = 8 THEN: r = 9: GOTO moved IF r = 18 THEN: r = 17: GOTO moved IF r = 17 THEN: r = 16: GOTO moved IF r = 16 THEN: r = 10: GOTO moved IF r = 11 THEN: r = 12: GOTO moved IF r = 13 THEN: r = 14: GOTO moved END IF IF cmd$ = "GO EAST" OR cmd$ = "EAST" OR cmd$ = "E" THEN IF r = 15 THEN: r = 14: GOTO moved IF r = 13 THEN: r = 11: GOTO moved IF r = 11 THEN: r = 10: GOTO moved IF r = 10 THEN: r = 8: GOTO moved IF r = 8 THEN: r = 1: GOTO moved IF r = 1 THEN: r = 4: GOTO moved IF r = 7 THEN: r = 6: GOTO moved IF r = 6 THEN: r = 5: GOTO moved IF r = 9 THEN: r = 2: GOTO moved IF r = 2 THEN: r = 3: GOTO moved IF r = 18 THEN: r = 19: GOTO moved IF r = 19 THEN: r = 20: GOTO moved END IF IF cmd$ = "GO SOUTH" OR cmd$ = "SOUTH" OR cmd$ = "S" THEN IF r = 14 THEN: r = 13: GOTO moved IF r = 12 THEN: r = 11: GOTO moved IF r = 10 THEN: r = 16: GOTO moved IF r = 16 THEN: r = 17: GOTO moved IF r = 17 THEN: r = 18: GOTO moved IF r = 9 THEN: r = 8: GOTO moved IF r = 8 THEN: r = 7: GOTO moved IF r = 2 THEN: r = 1: GOTO moved IF r = 1 THEN: r = 6: GOTO moved IF r = 3 THEN: r = 4: GOTO moved IF r = 4 THEN: r = 5: GOTO moved END IF IF cmd$ = "GO WEST" OR cmd$ = "WEST" OR cmd$ = "W" THEN IF r = 14 THEN: r = 15: GOTO moved IF r = 3 THEN: r = 2: GOTO moved IF r = 2 THEN: r = 9: GOTO moved IF r = 4 THEN: r = 1: GOTO moved IF r = 1 THEN: r = 8: GOTO moved IF r = 8 THEN: r = 10: GOTO moved IF r = 10 THEN: r = 11: GOTO moved IF r = 11 THEN: r = 13: GOTO moved IF r = 5 THEN: r = 6: GOTO moved IF r = 6 THEN: r = 7: GOTO moved IF r = 20 THEN: r = 19: GOTO moved IF r = 19 THEN: r = 18: GOTO moved END IF IF (cmd$ = "EXAMINE MAP") THEN CLS PRINT "Just an old cloth map, drawn out by some old timer." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "EXAMINE STATUE") AND gotstatue = 1 THEN CLS PRINT "An old gold statue, covered in dust, and cob webs." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "READ MAP") THEN CLS PRINT "Everything is smudged. You can't even make out the markings anymore." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "RETURN STATUE") AND gotstatue = 1 AND r = 20 THEN GOTO win: END IF IF (cmd$ = "LEAVE CRYPT") AND gotstatue = 1 AND r = 1 THEN GOTO lose: END IF IF (cmd$ = "TAKE STATUE") AND gotstatue = 0 AND r = 20 THEN gotstatue = 1 PRINT "You take the statue. But feel a sickness come over you." END IF moved: RETURN r1: PRINT "You are standing at the entrance of an old stone entrance. The smell" PRINT "of death fills the air." Movecount = Movecount + 1 RETURN r2: PRINT "A vast collection of stone rooms, each one a small little pocket" PRINT "with holes cut into the walls. Just how tall were these people?" Movecount = Movecount + 1 RETURN r3: PRINT "A cold breeze comes in from the ceiling. As if the hand of death" PRINT "has marked you." Movecount = Movecount + 1 RETURN r4: PRINT "A world hidden from the living. You begin to wonder what had" PRINT "happened to these once mighty people." Movecount = Movecount + 1 RETURN r5: PRINT "You begin to wonder just what awaits you within this tomb?" Movecount = Movecount + 1 RETURN r6: PRINT "You hear the strange cries of a woman...as if she's in mourning." Movecount = Movecount + 1 RETURN r7: PRINT "You hear the od tones of chanting picking up volume. A strange" PRINT "smell fills the room." Movecount = Movecount + 1 RETURN r8: PRINT "In the distance you can see the faint light from a torch...or candle." Movecount = Movecount + 1 RETURN r9: PRINT "You wonder what happened in this room? Why? It's the cleanest of" PRINT "them all." Movecount = Movecount + 1 RETURN r10: PRINT "Before you lyes long endless passages." Movecount = Movecount + 1 RETURN r11: PRINT "You hear a loud scream echo down the hallway. Just who else is here?" Movecount = Movecount + 1 RETURN r12: PRINT "A deadend, great." Movecount = Movecount + 1 RETURN r13: PRINT "The darkened hallway makes you rethink your plan. Is this really worth it?" Movecount = Movecount + 1 RETURN r14: PRINT "An intense sense of dread washes over you. You wonder what lurkes in" PRINT "the unknown?" Movecount = Movecount + 1 RETURN r15: PRINT "Nothing but a beaten up brick wall." Movecount = Movecount + 1 RETURN r16: PRINT "A foul stench comes from the floor. Are the rumors of those who entered" PRINT "this place true?" Movecount = Movecount + 1 RETURN r17: PRINT "You feel something touch your back...AHHHHHHHH...spider...sorry." Movecount = Movecount + 1 RETURN r18: PRINT "As you enter the ever expanding room, you can see the light in the end of" PRINT "the tunnel." Movecount = Movecount + 1 RETURN r19: PRINT "You carefully make your way through the room. You feel the eye's of the dead" PRINT "are upon you today." Movecount = Movecount + 1 RETURN r20: PRINT "There, standing before you, like a light in the darkness. Resting in a stone" PRINT "crypt rests King Lubok." PRINT "" IF gotstatue = 0 THEN: PRINT "A gold statue catches your eye. Resting upon his crypt." Movecount = Movecount + 1 RETURN win: COLOR 2, 0 CLS PRINT "You realize the error of your ways. Greed and lust will be the death of" PRINT "you. For now, you leave with life and knowledge. Something's are best" PRINT "left untouched by the hands of the living." PRINT "" PRINT "Thank you for playing!" DO: LOOP UNTIL INKEY$ <> "" END lose: COLOR 2, 0 CLS PRINT "You feel as if the life is being sucked from your being. Soon, as you" PRINT "leave...you fall ill...and die. Pity." PRINT "" PRINT "Thank you for playing!" DO: LOOP UNTIL INKEY$ <> "" END FUNCTION GrabInput$ x = POS(0) y = CSRLIN maxwidth = _WIDTH - x PCOPY 0, 1 'make a backup copy of the screen DO k = _KEYHIT i$ = INKEY$ LOOP UNTIL k = 0 AND INKEY$ = "" 'clear the keyboard buffer DO _LIMIT 30 PCOPY 1, 0 LOCATE y, x: PRINT Userinput$ k = _KEYHIT SELECT CASE k CASE 8 Userinput$ = LEFT$(Userinput$, LEN(Userinput$) - 1) CASE 65 TO 90, 97 TO 122, 32 Userinput$ = UCASE$(Userinput$ + CHR$(k)) END SELECT timerleft## = (DOOM - TIMER(0.001)) minutes = timerleft## \ 60 seconds = timerleft## - minutes * 60 seconds$ = LTRIM$(RTRIM$(STR$(seconds))): IF INSTR(seconds$, ".") = 2 THEN seconds$ = "0" + seconds$: LOCATE 2, 32: PRINT USING " ###:"; minutes; PRINT seconds$ IF timerleft## <= 0 THEN GOTO doomed _DISPLAY LOOP UNTIL k = 13 GrabInput$ = Userinput$ _AUTODISPLAY EXIT FUNCTION doomed: CLS PRINT "You must be new at this. Go back and try again. No hard feelings." _DISPLAY END END SUB